﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Excellent
{
    public partial class resultsForm : Form
    {
        public resultsForm()
        {
            InitializeComponent();
        }

        private void resultsForm_Load(object sender, EventArgs e)
        {
            string sql1 = string.Format("select * from  GLAcct");
            DataTable tb = DBHelper.GetDataSet(sql1).Tables[0];
            DataRow dr = tb.Rows[0];
            cBsubjects.ValueMember = "subjectsid";
            cBsubjects.DisplayMember = "subjects";
            cBsubjects.DataSource = tb;
        }

        private void btThequery_Click(object sender, EventArgs e)
        {
            string ame = LoginType.UserName;
            string cBsubjects = this.cBsubjects.SelectedValue.ToString();
          
            string sql = string.Format("select b.subjects,Thetesttime,results from GradeTable a, GLAcct" +
                "  b where  a.subjectsID = b.subjectsID and name='{0}'  and a.subjectsID='{1}'", ame, cBsubjects);
            DataSet ds = DBHelper.GetDataSet(sql);
            DataTable dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                this.dgvResult.DataSource = dt;
            } 
            
        }

      
    }
}
